<div class="text-center">
    <nav aria-label="Page navigation example">
        <ul class="pagination justify-content-center"> <!-- 添加 justify-content-center 类使分页居中 -->
            <!-- 上一页链接 -->
            @if ($paginator->onFirstPage())
                <li class="page-item disabled">
                    <a class="page-link" href="#" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                        <span class="visually-hidden">Previous</span> <!-- 添加辅助文本，提高可访问性 -->
                    </a>
                </li>
            @else
                <li class="page-item">
                    <a class="page-link" href="{{ $paginator->previousPageUrl() }}" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                        <span class="visually-hidden">Previous</span> <!-- 添加辅助文本，提高可访问性 -->
                    </a>
                </li>
            @endif

            <!-- 页码链接 -->
            @foreach ($elements as $element)
                @if (is_string($element))
                    <li class="page-item disabled"><span class="page-link">{{ $element }}</span></li>
                @endif

                @if (is_array($element))
                    @foreach ($element as $page => $url)
                        @if ($page == $paginator->currentPage())
                            <li class="page-item active" aria-current="page">
                                <span class="page-link">{{ $page }}<span class="visually-hidden">(current)</span></span> <!-- 添加辅助文本，提高可访问性 -->
                            </li>
                        @else
                            <li class="page-item">
                                <a class="page-link" href="{{ $url }}">{{ $page }}</a>
                            </li>
                        @endif
                    @endforeach
                @endif
            @endforeach

            <!-- 下一页链接 -->
            @if ($paginator->hasMorePages())
                <li class="page-item">
                    <a class="page-link" href="{{ $paginator->nextPageUrl() }}" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                        <span class="visually-hidden">Next</span> <!-- 添加辅助文本，提高可访问性 -->
                    </a>
                </li>
            @else
                <li class="page-item disabled">
                    <a class="page-link" href="#" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                        <span class="visually-hidden">Next</span> <!-- 添加辅助文本，提高可访问性 -->
                    </a>
                </li>
            @endif
        </ul>
    </nav>
</div>    